#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 8099
#EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Carlife.APi/Carlife.APi.csproj", "Carlife.APi/"]
COPY ["Carlife.Inf/Carlife.Inf.csproj", "Carlife.Inf/"]
COPY ["Models/Models.csproj", "Models/"]
COPY ["Commonality/Commonality.csproj", "Commonality/"]
COPY ["CarlifeRespository/CarlifeRespository.csproj", "CarlifeRespository/"]
COPY ["ICarlifeRespository/ICarlifeRespository.csproj", "ICarlifeRespository/"]
COPY ["ICarlifeService/ICarlifeService.csproj", "ICarlifeService/"]
COPY ["CarlifeService/CarlifeService.csproj", "CarlifeService/"]
RUN dotnet restore "Carlife.APi/Carlife.APi.csproj"
COPY . .
WORKDIR "/src/Carlife.APi"
RUN dotnet build "Carlife.APi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Carlife.APi.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Carlife.APi.dll"]